package org.bookr.engine.model;


import java.util.Date;

public abstract class AbstractBookrEntity {
    protected String id;
    protected Date createdDate, lastUpdateDate;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public Date getLastUpdateDate() {
        return lastUpdateDate;
    }

    public void setLastUpdateDate(Date lastUpdateDate) {
        this.lastUpdateDate = lastUpdateDate;
    }

    public Boolean isNew() {
        return (id == null || id.isEmpty());
    }

    public int getHashCode() {
        return getId() != null ? getId().hashCode() : super.hashCode();
    }

    @Override
    public int hashCode() {
        return getHashCode();
    }
}
